
from vector_store.load_vector_db import load_vector_db


# 从已有的数据库中寻找相似数据
db_vector = load_vector_db("./vector_store/db/chroma_db")
def perform_query(query, k):
    """执行查询并返回结果。"""
    docs_and_scores = db_vector.similarity_search_with_score(query, k)
    context = ""
    for doc, score in docs_and_scores:
        context += f"{doc.page_content}\n-----\n"
    return context